package com.rc.evcharger.dto.terminal;

import com.rc.evcharger.common.annotation.ByteLength;
import com.rc.evcharger.common.terminal.Result;

/**
 * 断电操作
 * Create by Yang on 2019/5/17
 */
public class PowerOffResult implements Result {

    @ByteLength(length = 1)
    private String status; // 断电成功01 断电失败02 复电成功03 复电失败 04

    @ByteLength(length = 1)
    private String reason;  //失败原因

    @ByteLength(length = 4)
    private String obligate; // 预留字段;

    @Override
    public PowerOffResult getResult(String dataStr) {
        dataStr = dataStr.trim();
        this.status = dataStr.substring(0, 2);
        dataStr = dataStr.substring(3);
        this.reason = dataStr.substring(0, 2);
        dataStr = dataStr.substring(3);
        this.obligate = dataStr;
        return this;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getReason() {
        return reason;
    }

    public void setReason(String reason) {
        this.reason = reason;
    }

    public String getObligate() {
        return obligate;
    }

    public void setObligate(String obligate) {
        this.obligate = obligate;
    }
}
